package com.olc.railing.dialog;

import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;

import com.olc.railing.R;

import butterknife.ButterKnife;


public abstract class BaseDialog extends Dialog {
	protected View view;
	protected OnSubmitListener onSubmit;
	protected Context context;
	public BaseDialog(Context context, OnSubmitListener onSubmit) {
		this(context,null,null,onSubmit);
	}

	public BaseDialog(Context context, String title, String content, OnSubmitListener onSubmit) {
		this(context,null,null,0,onSubmit);
	}

	public BaseDialog(Context context, String title, String content, int resId, OnSubmitListener onSubmit) {
		super(context, R.style.dialog);
		this.context = context;
		this.onSubmit = onSubmit;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		LayoutInflater inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		view = inflater.inflate(getlayoutId(), null);
		ButterKnife.bind(this, view);
		this.setContentView(view);
		getWindow().setBackgroundDrawable(new BitmapDrawable());
		setCanceledOnTouchOutside(false);
		initView();

	}
	public abstract int getlayoutId();
	public abstract void initView();


	public interface OnSubmitListener<T>{
		void onSubmit(T var);
	}


}
